package com.dindang.propertyfee.mvp.model;

import android.app.Application;

import com.dindang.propertyfee.mvp.contract.PropertyFeeRecordContract;
import com.dindang.propertyfee.mvp.model.api.service.CommonService;
import com.dindang.propertyfee.mvp.model.entity.BaseResponse;
import com.dindang.propertyfee.mvp.model.entity.PropertyCharge;
import com.google.gson.Gson;
import com.jess.arms.di.scope.FragmentScope;
import com.jess.arms.integration.IRepositoryManager;
import com.jess.arms.mvp.BaseModel;

import java.util.List;

import javax.inject.Inject;

import io.reactivex.Observable;


@FragmentScope
public class PropertyFeeRecordModel extends BaseModel implements PropertyFeeRecordContract.Model {
    @Inject
    Gson mGson;
    @Inject
    Application mApplication;

    @Inject
    public PropertyFeeRecordModel(IRepositoryManager repositoryManager) {
        super(repositoryManager);
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        this.mGson = null;
        this.mApplication = null;
    }

    @Override
    public Observable<BaseResponse<List<PropertyCharge.Record4Client>>> queryRecord4Client(PropertyCharge.Record4ClientParam param) {
        Observable<BaseResponse<List<PropertyCharge.Record4Client>>> base = mRepositoryManager.obtainRetrofitService(CommonService.class)
                .queryRecord4Client(param.page,
                        param.rows);
        return base;
    }
}